﻿using Moq;
using Soundteller.Audio.Repositories.Interfaces;
using Soundteller.AudioVisual.Model;
using Soundteller.AudioVisual.Repositories.Interfaces;
using Soundteller.AudioVisual.Services;
using Soundteller.AudioVisual.Services.Interfaces;
using Soundteller.Common.Tests;
using Soundteller.Visual.Model;
using Soundteller.Visual.Repositories.Interfaces;

namespace Soundteller.AudioVisual.Tests.Unit.Services.SoundtellerInitializerSpecifications
{
    public abstract class SoundtellerInitializerTestBase : TestBase
    {
        protected ISoundtellerInitializer SoundtellerInitializer { get; private set; }
        protected Mock<ISongRepository> SongRepository { get; private set; }
        protected Mock<IPadRepository> PadRepository { get; private set; }
        protected Mock<IGraphicRepository> GraphicRepository { get; private set; }
        protected abstract InitializeSoundtellerRequest Request { get; }
        protected GraphicBase AddedGraphic { get; private set; }

        protected override void Arrange()
        {
            SongRepository = new Mock<ISongRepository>();
            PadRepository = new Mock<IPadRepository>();

            GraphicRepository = new Mock<IGraphicRepository>();
            GraphicRepository.Setup(r => r.Add(It.IsAny<GraphicBase>())).Callback<GraphicBase>(g => AddedGraphic = g);

            SoundtellerInitializer = new SoundtellerInitializer(SongRepository.Object, PadRepository.Object, GraphicRepository.Object);
        }

        protected override void Act()
        {
            SoundtellerInitializer.Initialize(Request);
        }
    }
}
